package lambda;

/**
 * 方法引用
 */
public class LambdaDemo3 {
    public static void main(String[] args) {
        //

        Shop shop=new Shop();
        //匿名内部类写法
        /*Runnable r=new Runnable() {
            @Override
            public void run() {
                shop.bug();
            }
        };*/
        //lambda表达式写法
        //Runnable r= ()-> shop.bug();

        //简写,语法糖，方法引用
        /*Runnable r=shop::bug;
        Thread t =new Thread();
        t.start();*/
        //三和一之
        new Thread(shop::buy).start();
        //new Thread(()-> Shop.doSome()).start();
        //调用静态方法
        new Thread(Shop::doSome).start();



    }
}

class Shop{
    public void buy(){
        System.out.println("购买");
    }
    public static void doSome(){
        System.out.println("静态方法");
    }
}








